#pragma once

//@author A0096950U
#include <string>
#include <gtest\gtest.h>
#include <Logic.h>
#include <time.h>

class IntegrationTest : public ::testing::Test {
protected: 
	IntegrationTest(void) {
	}

	virtual ~IntegrationTest(void) {
	}

	virtual void SetUp() {
		resetXMLFile();

		logic = new Logic();
	}

	virtual void TearDown () {
		delete logic;
	}

	Logic *logic;

	vector<string> mainDisplay;
	vector<string> doneDisplay;
	vector<string> expectedMainDisplay;
	vector<string> expectedDoneDisplay;

	void updateDisplay() {
		vector<Task> mainDisplayTemp(logic->getMainDisplay());
		vector<Task> doneDisplayTemp(logic->getDoneDisplay());

		mainDisplay.clear();
		doneDisplay.clear();

		for(unsigned i = 0; i < mainDisplayTemp.size(); i++) {
			mainDisplay.push_back(mainDisplayTemp[i].toString());
		}

		for(unsigned i = 0; i < doneDisplayTemp.size(); i++) {
			doneDisplay.push_back(doneDisplayTemp[i].toString());
		}
	}

	void resetXMLFile() {
		fstream ofs;
		ofs.open("PowerSchedule.xml", ios::out | ios::trunc);
		ofs.close();
	}

	//@author A0105511Y
	string getTodayDate() {
		time_t t = time(0); 
		char tmp[64]; 
		strftime(tmp, sizeof(tmp), "%d%m%Y",localtime(&t));  
		return string(tmp);
	}
};

